﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace FinalProject
{
    public partial class WebForm9 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnDangNhap_Click(object sender, EventArgs e)
        {
            string cleanMessage = "";
            UserInformation userNew = new UserInformation();
            if (userNew.checkUserAccount(txtDiachimail.Text, txtMatkhau.Text))
            {
                //Đăng nhập thành công.                
                Session["username"] = userNew.StrEmail;
                Session["password"] = userNew.StrPassword;
                Response.Redirect("TaoHoSo-ThongTinChung.aspx");
            }
            else
            {
                cleanMessage = "Đăng nhập không thành công!";
                System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=\"JavaScript\">alert(\"" + cleanMessage + "\");</SCRIPT>");
                return;
            }             
        }
    }
}
